﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using dotNails.CodeGen.Models;

namespace dotNails.CodeGen.Models.dotNailsLinqToSqlGenerator {
	public class ProcResultsClass : CodeBlock {
		private List<Function> Functions { get; set; }
		
		public ProcResultsClass(List<Function> functions) {
			Functions = functions;

			TemplateFileName = Path.Combine(TemplatePath, "ProcResults.cst");
		}
		
		public override void PopulateTemplate(BaseCodeTemplate template) {
			base.PopulateTemplate(template);
			
			ProcResultsTemplate resultsTemplate = template as ProcResultsTemplate;

			if (resultsTemplate != null) {
				// Populate properties on the base template
				resultsTemplate.EntityBaseClass = string.Empty;
				resultsTemplate.Namespace = string.Empty;
				resultsTemplate.EntityClass = string.Empty;
				resultsTemplate.Functions = Functions;
			}
			else {
				throw new Exception("Template is not of type ProcResultsTemplate.  Check the ProcResults.cst file to make sure it inherits from ProcResultsTemplate");
			}
			
		}
	}
}